﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    public class EntityBase
    {
        /// <summary>
        /// 数据模型基础类
        /// </summary>
        public class Base
        {
            public Base()
            {
                this.ID = Guid.NewGuid();
                this.IsLock = false;
                this.IsDelete = false;
                this.CreatTime = DateTime.Now;
            }

            /// <summary>
            /// 自增ID
            /// </summary>
            [Key]
            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
            public int AutoID { get; set; }

            /// <summary>
            /// 主键
            /// </summary>
            [Column("P01")]
            [Key]
            [DatabaseGenerated(DatabaseGeneratedOption.None)]
            public Guid ID { get; set; }

            /// <summary>
            /// 是否被锁定
            /// </summary>
            [Column("P02")]
            public Boolean IsLock { get; set; }

            /// <summary>
            /// 是否删除
            /// </summary>
            [Column("P03")]
            public bool IsDelete { get; set; }

            /// <summary>
            /// 创建时间
            /// </summary>
            [Required]
            [Column("P04")]
            public DateTime CreatTime { get; set; }
        }
    }
}
